<div id='StoreGoodsEditImgs_List2'></div>

<script>
	GoodsConEditImgs_View();
	function GoodsConEditImgs_View(){
		var data = {
			type:'GetImgList',
			gid:edit_id
		};
		Ajax2(data,function(res){
			if(!/^\[{"id":.*\]$/.test(res)){
				$('#StoreGoodsEditImgs_List2').html('');
				return;
			}
			var imgListData = JSON.parse(res);
			var StoreGoodsEditImgs_ListStr = '';
			for(var i=0;i<imgListData.length;i++){
				StoreGoodsEditImgs_ListStr += "<div style='margin:10px;position:relative;display:inline-block;border:1px solid #ccc;'>";
				StoreGoodsEditImgs_ListStr += "<span style='border:1px solid;padding:0 6px;border-radius:15px;position:absolute;right:-10px;top:-10px;background:#fff' onclick=GoodsConEdit_DelImg("+imgListData[i].id+",'"+imgListData[i].addr+"') >X</span>";
			
				var src = upyun_shop_img+imgListData[i].addr;
				StoreGoodsEditImgs_ListStr += "<img srcs='../Public/Image/base.png' src='"+src+"' style='height:80px' alt='暂无'>";
				
				StoreGoodsEditImgs_ListStr += "<div style='text-align:center;margin:5px 0;font-size:13px;color:blue' onclick=GoodsConEditImgs_ChangeBanner('"+imgListData[i].addr+"')>设置封面</div>";
				StoreGoodsEditImgs_ListStr += "</div>";
			}
			$('#StoreGoodsEditImgs_List2').html(StoreGoodsEditImgs_ListStr);

		//	Img_Later_View(150,100);
		},after_url);


	}


	//修改封面图
	function GoodsConEditImgs_ChangeBanner(path){
		$('#GoodsConEdit_Banner').attr('src',upyun_shop_img+path);
		GoodsConEdit_info.banner = path;
	}


	//删除图片
	function GoodsConEdit_DelImg(img_id,img_addr){
		if(!confirm('确认操作?')){
			return;
		}
		var data = {
			type:'GoodsImageDel',
			img_id:img_id,
			img_addr:img_addr,
			goods_id:edit_id
		};
		Ajax2(data,function(res){
			C(res);
			if(res == 'ok'){
				if(GoodsConEdit_info.banner == img_addr){
					GoodsConEdit_info.banner = '';	//清空商品信息中的banner
					$('#GoodsConEdit_Banner').attr('src',base_img);	//将banner置为默认图片
				}
				A('操作成功！');
				StoreGoodsEdit_GetImgList();	//重新加载图片列表
			}else{
				A('操作失败！');
			}
		},after_url);
	}
</script>